/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package view;

import java.awt.Graphics;
import javax.swing.ImageIcon;
import model.Suit;
import utility.ImageToolbox;

/**
 *
 * @author Jeppe
 */
public class KulørVælgerDialog extends javax.swing.JDialog {
    private ImageToolbox imgTB;
    private MainGui mainGui;
    /**
     * Creates new form KulørVælgerDialog
     */
    public KulørVælgerDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        mainGui = (MainGui) parent;
        imgTB = new ImageToolbox();
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        hjerterLabel = new javax.swing.JLabel(){
            public void paint (Graphics g){
                super.paint(g);
                imgTB.drawImage(g, (ImageIcon)hjerterLabel.getIcon(), 0, 0, hjerterLabel.getSize().width, hjerterLabel.getSize().height);
            }
        }
        ;
        sparLabel = new javax.swing.JLabel(){
            public void paint (Graphics g){
                super.paint(g);
                imgTB.drawImage(g, (ImageIcon)sparLabel.getIcon(), 0, 0, sparLabel.getSize().width, sparLabel.getSize().height);
            }
        }
        ;
        ruderLabel = new javax.swing.JLabel(){
            public void paint (Graphics g){
                super.paint(g);
                imgTB.drawImage(g, (ImageIcon)ruderLabel.getIcon(), 0, 0, hjerterLabel.getSize().width, hjerterLabel.getSize().height);
            }
        }
        ;
        klørLabel = new javax.swing.JLabel(){
            public void paint (Graphics g){
                super.paint(g);
                imgTB.drawImage(g, (ImageIcon)klørLabel.getIcon(), 0, 0, klørLabel.getSize().width, klørLabel.getSize().height);
            }
        }
        ;

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setUndecorated(true);

        jLabel1.setFont(new java.awt.Font("MS Gothic", 0, 14)); // NOI18N
        jLabel1.setText("Hvilken kulør vil du skifte til?");

        hjerterLabel.setBackground(new java.awt.Color(255, 51, 102));
        hjerterLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kuloer/Hjerter.png"))); // NOI18N
        hjerterLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                hjerterLabelMouseClicked(evt);
            }
        });

        sparLabel.setBackground(new java.awt.Color(255, 51, 102));
        sparLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kuloer/spar.png"))); // NOI18N
        sparLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                sparLabelMouseClicked(evt);
            }
        });

        ruderLabel.setBackground(new java.awt.Color(255, 51, 102));
        ruderLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kuloer/Ruder.png"))); // NOI18N
        ruderLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ruderLabelMouseClicked(evt);
            }
        });

        klørLabel.setBackground(new java.awt.Color(255, 51, 102));
        klørLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kuloer/klør.png"))); // NOI18N
        klørLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                klørLabelMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(15, 15, 15)
                .addComponent(hjerterLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(ruderLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                .addComponent(klørLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(sparLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel1)
                .addGap(27, 27, 27))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(hjerterLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ruderLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(klørLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(sparLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void hjerterLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_hjerterLabelMouseClicked
        mainGui.stopVisningAfKulørVælger(Suit.Hjerter);
    }//GEN-LAST:event_hjerterLabelMouseClicked

    private void ruderLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ruderLabelMouseClicked
        mainGui.stopVisningAfKulørVælger(Suit.Ruder);
    }//GEN-LAST:event_ruderLabelMouseClicked

    private void klørLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_klørLabelMouseClicked
        mainGui.stopVisningAfKulørVælger(Suit.Klør);
    }//GEN-LAST:event_klørLabelMouseClicked

    private void sparLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_sparLabelMouseClicked
        mainGui.stopVisningAfKulørVælger(Suit.Spar);
    }//GEN-LAST:event_sparLabelMouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(KulørVælgerDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(KulørVælgerDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(KulørVælgerDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(KulørVælgerDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                KulørVælgerDialog dialog = new KulørVælgerDialog(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel hjerterLabel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel klørLabel;
    private javax.swing.JLabel ruderLabel;
    private javax.swing.JLabel sparLabel;
    // End of variables declaration//GEN-END:variables
}
